
<div id="main-content">
  <div class="container-fluid">
    <ul class="breadcrumb">
      <li><a href="<?php print site_url("frm/accounting/journal")?>"><?php print lang('frm_journal')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/journal-log/".$id_frm_journal)?>"><?php print lang('frm_journal_transaksi')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/all-buku-besar/".$id_frm_journal)?>"><?php print lang('frm_buku_besar')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/neraca/".$id_frm_journal)?>"><?php print lang('frm_neraca')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/work-sheet/".$id_frm_journal)?>"><?php print lang('frm_work_sheet')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/labarugi/".$id_frm_journal)?>"><?php print lang('frm_labarugi')?></a><span class="divider">»</span></li>
      <li><a href="<?php print site_url("frm/accounting/perubahan-modal/".$id_frm_journal)?>"><?php print lang('frm_perubahan_modal')?></a><span class="divider">»</span></li>
      <li class="active"><?php print $title?></li>
    </ul>
    <div class="row-fluid">
      <div class="span6">
        <div class="widget-block">
          <div class="widget-head">
            <h5>ACTIVA</h5>
          </div>
          <div class="widget-content">
            <div class="widget-box">
              <table class="table">
                <thead style="background-color: rgba(128, 128, 128, 0.33);">
                  <tr>
                    <th>No Akun</th>
                    <th>Name</th>
                    <th>Saldo</th>
                    <th>Total</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td colspan="4"><b>Activa Lancar</b></td>
                  </tr>
                  <?php
                  if(is_array($data)){
                    $nbs = 0;
                    foreach ($data as $key => $value) {
                      
                      if($value->pos_counter == 1){
                        $name_debit = "<a href='".site_url("frm/accounting/buku-besar/".$id_frm_journal."/".$value->id_frm_account)."'>".$value->title."</a>";
                        $price_debit = "Rp ".number_format($value->price, 0, ",",".");
                        $total_debit += $value->price;
                      }
                      print "
                  <tr>
                    <td>{$value->nomor}</td>
                    <td>{$name_debit}</td>
                    <td style='text-align: right;'>{$price_debit}</td>
                    <td style='text-align: right;'></td>
                  </tr>"
                  ;
                    }
                  }
                  print "
                    <tr>
                      <td colspan='3' style='text-align: center;'><b>Total Activa Lancar</b></td>
                      <td style='text-align: right;'><b>Rp ".  number_format($total_debit, 0, ",", ".")."</b></td>
                    </tr>
                    <tr>
                      <td colspan='4'><b>Activa Tetap</b></td>
                    </tr>
                    "
                    ;
                  foreach ($data2 as $key => $value) {
                      
//                    if($value->pos_counter == 1){
                      $name_debit_t = "<a href='".site_url("frm/accounting/buku-besar/".$id_frm_journal."/".$value->id_frm_account)."'>".$value->title."</a>";
                      $price_debit_t = "Rp ".number_format($value->price, 0, ",",".");
                      $total_debit_t += $value->price;
//                    }
                    print "
                <tr>
                  <td>{$value->nomor}</td>
                  <td>{$name_debit_t}</td>
                  <td style='text-align: right;'>{$price_debit_t}</td>
                  <td style='text-align: right;'></td>
                </tr>"
                ;
                    }
                  ?>
                  <tr>
                    <td colspan='3' style='text-align: center;'><b>Total Activa Tetap</b></td>
                    <td style='text-align: right;'><b>Rp <?php print number_format($total_debit_t, 0, ",", ".")?></b></td>
                  </tr>
                </tbody>
                <tfoot style="font-weight: bold; background-color: rgba(128, 128, 128, 0.33);">
                  <tr>
                    <td colspan="3" style="text-align: center">TOTAL ACTIVA</td>
                    <td style="text-align: right">Rp <?php print number_format(($total_debit + $total_debit_t), 0, ",", ".")?></td>
                  </tr>
                </tfoot>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="span6">
        <div class="widget-block">
          <div class="widget-head">
            <h5>PASIVA</h5>
          </div>
          <div class="widget-content">
            <div class="widget-box">
              <table class="table">
                <thead style="background-color: rgba(128, 128, 128, 0.33);">
                  <tr>
                    <th>No Akun</th>
                    <th>Name</th>
                    <th>Saldo</th>
                    <th>Total</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td colspan="4"><b>Kewajiban</b></td>
                  </tr>
                  <?php
                    foreach ($data3 as $key => $value) {
                      
      //                    if($value->pos_counter == 1){
                        $name_debit_k = "<a href='".site_url("frm/accounting/buku-besar/".$id_frm_journal."/".$value->id_frm_account)."'>".$value->title."</a>";
                        $price_debit_k = "Rp ".number_format($value->price, 0, ",",".");
                        $total_debit_k += $value->price;
  //                    }
                      print "
                      <tr>
                        <td>{$value->nomor}</td>
                        <td>{$name_debit_k}</td>
                        <td style='text-align: right;'>{$price_debit_k}</td>
                        <td style='text-align: right;'></td>
                      </tr>"
                      ;
                    }
                  ?>
                  <tr>
                    <td colspan='3' style='text-align: center;'><b>Total Kewajiban</b></td>
                    <td style='text-align: right;'><b>Rp <?php print number_format($total_debit_k, 0, ",", ".")?></b></td>
                  </tr>
                  
                  <tr>
                    <td colspan="4"><b>Modal</b></td>
                  </tr>
                  <?php
                    foreach ($data4 as $key => $value) {
                      
      //                    if($value->pos_counter == 1){
                        $price_debit_m = "Rp ".number_format($value->price, 0, ",",".");
                        $total_debit_m += $value->price;
  //                    }
                      print "
                      <tr>
                        <td>{$modal[0]->nomor}</td>
                        <td><a href='".site_url("frm/accounting/buku-besar/".$id_frm_journal."/".$modal[0]->id_frm_account)."'>{$modal[0]->title}</a></td>
                        <td style='text-align: right;'>{$price_debit_m}</td>
                        <td style='text-align: right;'></td>
                      </tr>"
                      ;
                    }
                  ?>
                  <tr>
                    <td colspan='3' style='text-align: center;'><b>Total Modal</b></td>
                    <td style='text-align: right;'><b>Rp <?php print number_format($total_debit_m, 0, ",", ".")?></b></td>
                  </tr>
                </tbody>
                <tfoot style="font-weight: bold; background-color: rgba(128, 128, 128, 0.33);">
                  <tr>
                    <td colspan="3" style="text-align: center">TOTAL KEWAJIBAN + MODAL</td>
                    <td style="text-align: right">Rp <?php print number_format(($total_debit_m + $total_debit_k), 0, ",", ".")?></td>
                  </tr>
                </tfoot>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>